#include <iostream>
#include <vector>
using namespace std;
/**
 * Definition for a binary tree node.
*/
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
class Solution {
public:
    vector<int> inorderTraversal(TreeNode* root) {
        inorderTv(root);
        return res;
    }
private:
    void inorderTv(TreeNode *root)
    {
        if (root == nullptr) {
            return;
        }
        inorderTv(root->left);
        res.emplace_back(root->val);
        inorderTv(root->right);
    }
    vector<int> res;
};